package org.example.week10;

import jakarta.servlet.*;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.*;

import java.io.IOException;

@WebServlet("/account-deactivation")
public class AccountServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException {
        
        UserDAO userDAO = new UserDAO();
        int userId = Integer.parseInt(request.getParameter("id"));
        
        userDAO.accountDeactivation(userId);
        request.getSession().invalidate();
        response.sendRedirect("index.jsp");
    }
}
